package com.flying.scorer.score.equity.quarterlyreport;

import com.flying.refdata.model.equity.EquityInfo;
import com.flying.refdata.model.equity.QuarterlyReport;
import com.flying.refdata.service.ReportService;
import com.flying.scorer.score.ScoreException;

public class ROE20EquityScorer extends AbstractQuarterlyReportScorer {
    public ROE20EquityScorer(ReportService reportService) {
        super(reportService);
    }

    @Override
    public double score(int date, EquityInfo info) throws ScoreException {
        QuarterlyReport qr = getQuarterlyReport(info, date);
        double roe = qr.getNetAssetROE();
        if (roe < 1) return 0;
        else if (roe < 2) return 1;
        else if (roe < 3) return 2;
        else if (roe < 4) return 3;
        else if (roe < 5) return 4;
        else if (roe < 6) return 5;
        else if (roe < 7) return 6;
        else if (roe < 8) return 7;
        else if (roe < 9) return 8;
        else if (roe < 10) return 9;
        else if (roe < 11) return 10;
        else if (roe < 12) return 11;
        else if (roe < 13) return 12;
        else if (roe < 14) return 13;
        else if (roe < 15) return 14;
        else if (roe < 16) return 15;
        else if (roe < 17) return 16;
        else if (roe < 18) return 17;
        else if (roe < 19) return 18;
        else if (roe < 20) return 19;
        else return 20;
    }
}
